program unique_constraint;

class packet;
    rand bit [1:0] v0, v1, v2, v3;
    rand bit [2:0] arr[];
    constraint var_c  { unique {v0, v1, v2, v3}; }
    constraint size_c { arr.size() == 8; }
    constraint data_c { unique { arr }; } 
endclass

initial begin
    packet pkt;
    pkt = new();
    repeat(10) begin
        $display("==================================");
        pkt.randomize();
        $display("\tv0 = %0d, v1 = %0d, v2 = %0d, v3 = %0d", pkt.v0, pkt.v1, pkt.v2, pkt.v3);
        foreach (pkt.arr[i]) begin
            $display("\tarr[%0d] = %0d", i, pkt.arr[i]);
        end
    end
end

endprogram
